package com.cx330;

import java.io.UnsupportedEncodingException;
import java.util.Arrays;

public class Example53 {
    public static void main(String[] args) throws UnsupportedEncodingException {
        String str = "Cx330范奎";
        byte[] bytes1 = str.getBytes("GBK");
        System.out.println(Arrays.toString(bytes1));
        String result1 = new String(bytes1, "GBK");
        System.out.println("result1 = " + result1);
        System.out.println("===========================");
        byte[] bytes2 = str.getBytes("UTF-8");
        System.out.println(Arrays.toString(bytes2));
        String result2 = new String(bytes2, "UTF-8");
        System.out.println("result2 = " + result2);
        System.out.println("===========================");
        String result3 = new String(bytes1, "UTF-8");
        System.out.println("result3 = " + result3);
    }
}
